﻿using System;
using System.Collections.Generic;

using BizElements.Core;

namespace BizElements.BusinessLayer
{
    /// <summary>Defines commonly used entity function/permission IDs such as: read, write, assignment, UI functions.</summary>
    public sealed class EntityPermissionSet
    {
        /// <summary>Initializes a new instance of EntityPermissions class.</summary>
        internal EntityPermissionSet()
        { 
        }

        /// <summary>Initializes a new instance of EntityPermissions class.</summary>
        /// <param name="readPermission">Permission/action ID required to read/access existing entity.</param>
        /// <param name="readUnitPermission">Permission/action ID required to read/access existing entity that belong to the user's business unit.</param>
        /// <param name="readChildUnitPermission">Permission/action ID required to read/access existing entity that belong to the user's business unit and its child units.</param>
        /// <param name="readAllPermission">Permission/action ID required to read/access any existing entity that belongs to user's organization.</param>
        /// <param name="readUnassignedPermission">Permission/action ID required to read/access unassigned entities, it. the ones where neither owner nor unit nor team have been set.</param>
        /// <param name="createPermission">Permission/action ID required to create a new entity.</param>
        /// <param name="updatePermission">Permission/action ID required to update existing entity.</param>
        /// <param name="deletePermission">Permission/action ID required to deactivate/delete existing entity.</param>
        /// <param name="assignOwnerPermission">Permission/action ID required to (re)assign ownership of entity to another user from the user's organization.</param>
        /// <param name="assignChildUnitPermission">Permission/action ID required to (re)assign ownership of entity to a child business unit.</param>
        /// <param name="assignAnyUnitPermission">Permission/action ID required to (re)assign ownership of entity to any business unit in the user's organization.</param>
        /// <param name="assignAnyTeamPermission">Permission/action ID required to (re)assign ownership of entity to any team in the user's organization.</param>
        /// <param name="viewPkPermission">Permission/action ID required to view and use entity primary key.</param>
        /// <param name="userInterfacePermission">Permission/action ID required to manage entity via application's user interface.</param>
        public EntityPermissionSet(object readPermission, object readUnitPermission, object readChildUnitPermission, object readAllPermission, object readUnassignedPermission, object createPermission, object updatePermission, object deletePermission, object assignOwnerPermission, object assignChildUnitPermission, object assignAnyUnitPermission, object assignAnyTeamPermission, object viewPkPermission, object userInterfacePermission)
        {
            this.ReadPermission = readPermission;
            this.ReadUnitPermission = readUnitPermission;
            this.ReadChildUnitPermission = readChildUnitPermission;
            this.ReadAllPermission = readAllPermission;
            this.ReadUnassignedPermission = readUnassignedPermission;
            this.CreatePermission = createPermission;
            this.UpdatePermission = updatePermission;
            this.DeletePermission = deletePermission;
            this.AssignOwnerPermission = assignOwnerPermission;
            this.AssignChildUnitPermission = assignChildUnitPermission;
            this.AssignAnyUnitPermission = assignAnyUnitPermission;
            this.AssignAnyTeamPermission = assignAnyTeamPermission;
            this.ViewPkPermission = viewPkPermission;
            this.UserInterfacePermission = userInterfacePermission;
        }

        /// <summary>Permission/action ID required to read/access existing entity.</summary>
        public object ReadPermission { get; internal set; }
        /// <summary>Permission/action ID required to read/access existing entity that belong to the user's business unit.</summary>
        public object ReadUnitPermission { get; internal set; }
        /// <summary>Permission/action ID required to read/access existing entity that belong to the user's business unit and its child units.</summary>
        public object ReadChildUnitPermission { get; internal set; }
        /// <summary>Permission/action ID required to read/access any existing entity that belongs to user's organization.</summary>
        public object ReadAllPermission { get; internal set; }
        /// <summary>Permission/action ID required to read/access unassigned entities, it. the ones where neither owner nor unit nor team have been set.</summary>
        public object ReadUnassignedPermission { get; internal set; }

        /// <summary>Permission/action ID required to create a new entity.</summary>
        public object CreatePermission { get; internal set; }
        /// <summary>Permission/action ID required to update existing entity.</summary>
        public object UpdatePermission { get; internal set; }
        /// <summary>Permission/action ID required to deactivate/delete existing entity.</summary>
        public object DeletePermission { get; internal set; }

        /// <summary>Permission/action ID required to (re)assign ownership of entity to another user from the user's organization.</summary>
        public object AssignOwnerPermission { get; internal set; }
        /// <summary>Permission/action ID required to (re)assign ownership of entity to a child business unit.</summary>
        public object AssignChildUnitPermission { get; internal set; }
        /// <summary>Permission/action ID required to (re)assign ownership of entity to any business unit in the user's organization.</summary>
        public object AssignAnyUnitPermission { get; internal set; }
        /// <summary>Permission/action ID required to (re)assign ownership of entity to any team in the user's organization.</summary>
        public object AssignAnyTeamPermission { get; internal set; }

        /// <summary>Permission/action ID required to view and use entity primary key.</summary>
        public object ViewPkPermission { get; internal set; }
        /// <summary>Permission/action ID required to manage entity via application's user interface.</summary>
        public object UserInterfacePermission { get; internal set; }
    }
}
